2 use Wikimedia\ScopedCallback
;
5 * This is the TestCase subclass for running a single parser test via the
6 * ParserTestRunner integration test system.
8 * Note: the following groups are not used by PHPUnit.
9 * The list in ParserTestFileSuite::__construct() is used instead.
17 class ParserIntegrationTest
extends PHPUnit_Framework_TestCase
{
19 use MediaWikiCoversValidator
;
24 /** @var ParserTestRunner */
27 /** @var ScopedCallback */
28 private $ptTeardownScope;
30 public function __construct( $runner, $fileName, $test ) {
31 parent
::__construct( 'testParse', [ '[details omitted]' ],
32 basename( $fileName ) . ': ' . $test['desc'] );
33 $this->ptTest
= $test;
34 $this->ptRunner
= $runner;
37 public function testParse() {
38 $this->ptRunner
->getRecorder()->setTestCase( $this );
39 $result = $this->ptRunner
->runTest( $this->ptTest
);
40 $this->assertEquals( $result->expected
, $result->actual
);
43 public function setUp() {
44 $this->ptTeardownScope
= $this->ptRunner
->staticSetup();
47 public function tearDown() {
48 if ( $this->ptTeardownScope
) {
49 ScopedCallback
::consume( $this->ptTeardownScope
);